package com.crx.springbootinit.controller.admin;

import com.crx.springbootinit.annotation.AuthCheck;
import com.crx.springbootinit.annotation.LogApiAnno;
import com.crx.springbootinit.common.BaseResponse;
import com.crx.springbootinit.common.ResultUtils;
import com.crx.springbootinit.model.dto.follow.FollowPageDTO;
import com.crx.springbootinit.model.dto.love.LovePageDTO;
import com.crx.springbootinit.model.dto.page.PageVO;
import com.crx.springbootinit.model.vo.follow.FollowPageVo;
import com.crx.springbootinit.model.vo.love.LoveMyPostVO;
import com.crx.springbootinit.service.IFollowService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 谢杭延
 * @Date 2024-11-01 12:52
 */
@RequiredArgsConstructor
@Api(tags = "后台关注模块接口")
@RestController
@RequestMapping("/admin/follow")
public class FollowAdminController {

    private final IFollowService followService;

    @DeleteMapping("/delete/{ids}")
    @ApiOperation("删除关注")
    @LogApiAnno(title = "关注模块", businessType = "DELETE")
    @AuthCheck
    public BaseResponse<Void> deleteFollow(@ApiParam("关注id列表") @PathVariable List<Long> ids){
        followService.removeByIds(ids);
        return BaseResponse.success();
    }

    @GetMapping("/page")
    @ApiOperation("分页查询关注列表")
    @LogApiAnno(title = "关注模块", businessType = "GET")
    @AuthCheck
    public BaseResponse<PageVO<FollowPageVo>> queryFollowPage(FollowPageDTO followPageDTO){
        PageVO<FollowPageVo> pageVO = followService.queryFollowPage(followPageDTO);
        return BaseResponse.success(pageVO);
    }

}
